from django.contrib import admin

from livesettings import config_value
from product.models import Category
from product.admin import CategoryAdminForm, CategoryImage_Inline, CategoryTranslation_Inline

from satchmo_tuning.models import CategoryTuning

# line-by-line copy from product.adminCategoryOptions
class CategoryTuningOptions(admin.ModelAdmin):
    list_display = ('site','name', '_parents_repr')
    list_display_links = ('name',)
    ordering = ['site', 'parent__id', 'ordering', 'name']
    inlines = [CategoryImage_Inline]
    if config_value('LANGUAGE','SHOW_TRANSLATIONS'):
        inlines.append(CategoryTranslation_Inline)
    filter_horizontal = ('related_categories',)
    form = CategoryAdminForm   


admin.site.unregister(Category)
admin.site.register(CategoryTuning, CategoryTuningOptions)
